package com.xhsj.user.hr.process.overtime.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xhsj.user.hr.process.hrLeaveProcess.vo.FindToDoListVo;
import com.xhsj.user.hr.process.overtime.entity.TbHrOvertimeApplyTime;
import com.xhsj.user.hr.process.overtime.vo.FindUsageVo;
import com.xhsj.user.hr.system.entity.TbHrZhaopinDemandApply;
import com.xhsj.user.hr.system.vo.OverTimeApplyAuditTaskVo;
import org.apache.ibatis.annotations.Mapper;
import com.xhsj.user.hr.process.overtime.entity.TbHrOvertimeApply;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.io.Serializable;
import java.util.List;
/**
 * <p>
 * 加班申请 Mapper 接口
 * </p>
 *
 * @author suxiaolin
 * @since 2020-10-16
 */
@Mapper
public interface TbHrOvertimeApplyMapper extends BaseMapper<TbHrOvertimeApply> {

    /**
     * 通过申请id删除数据
     * @author 苏小林
     * @date 2020/10/20 17:12
     * @param: id
     */
    void delByApplyId(@Param("id") Long id);

    /**
     * 查询正在执行的任务
     * @author 苏小林
     * @date 2020/10/22 17:00
     * @param: page
     * @param: userId
     * @param: roleIds
     * @return: com.baomidou.mybatisplus.core.metadata.IPage<com.xhsj.user.hr.system.vo.OverTimeApplyAuditTaskVo>
     */
    IPage<OverTimeApplyAuditTaskVo> findRunTask(Page<TbHrOvertimeApply> page, @Param("userId") Long userId, @Param("roleIds") List<Long> roleIds);

    /**
     * 查询历史任务
     * @author 苏小林
     * @date 2020/10/22 17:01
     * @param: page
     * @param: userId
     * @return: com.baomidou.mybatisplus.core.metadata.IPage<com.xhsj.user.hr.system.vo.OverTimeApplyAuditTaskVo>
     */
    IPage<OverTimeApplyAuditTaskVo> findHiTask(Page<TbHrOvertimeApply> page, @Param("userId") Long userId);

    /**
     * 查询我的申请
     * @author 苏小林
     * @date 2020/10/23 10:19
     * @param: page
     * @param: entity
     * @return: com.baomidou.mybatisplus.core.metadata.IPage<com.xhsj.user.hr.process.overtime.entity.TbHrOvertimeApply>
     */
    IPage<TbHrOvertimeApply> findOverTimeApplyList(Page<TbHrOvertimeApply> page, @Param("entity") TbHrOvertimeApply entity);

    /**
     * 获取加班时长
     * @author liuqinghua
     * @date Sep 1, 2020 10:07:11 AM
     */
    int getHrOvertime(@Param("userId") Long userId);

    /**
     * 查询所有加班申请数据
     * @author 苏小林
     * @date 2020/10/23 13:37
     * @param: page
     * @return: java.util.List<com.xhsj.user.hr.process.overtime.entity.TbHrOvertimeApply>
     */
    IPage<TbHrOvertimeApply> findAllOverTimeApplyList(Page<TbHrOvertimeApply> page,@Param("organizationId") Long organizationId,
                                                      @Param("positionId") Long positionId,
                                                      @Param("name") String name);

    /**
     * 查询加班使用情况
     * @author 苏小林
     * @date 2020/10/23 15:47
     * @param: page
     * @param: findUsageVo
     * @return: com.baomidou.mybatisplus.core.metadata.IPage<com.xhsj.user.hr.process.overtime.entity.TbHrOvertimeApply>
     */
    IPage<FindUsageVo> findUsage(Page<TbHrOvertimeApply> page, @Param("entity") FindUsageVo entity);

    /**
     * 查询年度用户所有的加班详情
     * @author 苏小林
     * @date 2020/10/26 11:19
     * @param: userId
     * @param: year
     * @return: java.util.List<com.xhsj.user.hr.process.overtime.entity.TbHrOvertimeApplyTime>
     */
    List<TbHrOvertimeApplyTime> findDetailByUserId(@Param("userId") String userId, @Param("year") String year);

    TbHrOvertimeApply getDataById(@Param("id") Serializable id);

    /**
     * 物理删除
     * @author 苏小林
     * @date 2020/11/2 17:53
     * @param: dataId
     */
    void delById(@Param("dataId") Long dataId);

    /**
     * 查询加班待办数据
     * @author 苏小林
     * @date 2021/4/15 10:02
     * @param: userId
     * @param: roleIds
     * @return: java.util.List<com.xhsj.user.hr.process.hrLeaveProcess.vo.FindToDoListVo>
     */
    List<FindToDoListVo> findToList(@Param("userId") Long userId, @Param("roleIds") List<Long> roleIds);
}
